package jus.aor.talk.v1;

import java.awt.Dimension;
import java.awt.Toolkit;

import jus.aor.talk.ui.client.TalkEventIntervenantAdaptator;
import jus.aor.talk.ui.client._IntervenantComposant;
import jus.aor.talk.ui.client._TalkEventIntervenantAdaptator;
import jus.aor.talk.ui.server.TalkUi;

public class TestTalk {
	protected static Forum forum;
	protected static jus.aor.talk.ui.client.TalkUi beanTalk1, beanTalk2;
	protected static _IntervenantComposant intervenant1, intervenant2;
	protected static _TalkEventIntervenantAdaptator adaptator1, adaptator2;
	
	public static Forum searchForum(String forum) {return TestTalk.forum;}
	
	public static void main( String[] args) throws Exception{
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

		forum = new Forum();
		TalkUi talkUi = new TalkUi(forum);
		forum .addServerEventListener(talkUi);
		
		talkUi.setSize(400,400);
		talkUi.setLocation((dim.width-talkUi.getWidth())/2,(dim.height-talkUi.getHeight())/2);

		beanTalk1 = new jus.aor.talk.ui.client.TalkUi();
		beanTalk2 = new jus.aor.talk.ui.client.TalkUi();
		beanTalk1.setLocation((dim.width-talkUi.getWidth())/2-beanTalk1.getWidth(),(dim.height-talkUi.getHeight())/2);
		beanTalk2.setLocation((dim.width+talkUi.getWidth())/2,(dim.height-talkUi.getHeight())/2);

		intervenant1=new Intervenant();
		intervenant2=new Intervenant();
		adaptator1 =new TalkEventIntervenantAdaptator(intervenant1);
		adaptator2 =new TalkEventIntervenantAdaptator(intervenant2);
		intervenant1.setAdaptator(adaptator1);
		intervenant2.setAdaptator(adaptator2);
		beanTalk1.addTalkEventListener(adaptator1);
		beanTalk2.addTalkEventListener(adaptator2);
		adaptator1.addIntervenantEventListener(beanTalk1);
		adaptator2.addIntervenantEventListener(beanTalk2);
	}
}